<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::any('msg', function(){
    return view('message');
});
Auth::routes();
Route::group(['middleware'=>['role.base','role.menu','role.auth','role.log']], function (){
    Route::get('/', 'HomeController@index')->name('home.index');
});

Route::group(['prefix'=>'setting', 'namespace' => 'Setting', 'middleware'=>['role.base','role.menu','role.auth','role.log']], function (){

    Route::get('user/index','UserController@index')->name('setting.user.index');
    Route::get('user/log','UserController@log')->name('setting.user.log');
    Route::get('user/edit','UserController@edit')->name('setting.user.edit');
    Route::get('user/save','UserController@save')->name('setting.user.save');
    Route::get('user/department','UserController@department')->name('setting.user.department');
    Route::post('user/destroyall', 'UserController@destroyAll')->name('setting.user.destroy.all');
    Route::name('setting')->resource('user', 'UserController');


    Route::post('role/destroyall', 'RoleController@destroyAll')->name('setting.role.destroy.all');
    Route::get('role/{id}/permission', 'RoleController@permission')->name('setting.role.permission');
    Route::post('role/{id}/permission', 'RoleController@storePermission')->name('setting.role.permission');
    Route::name('setting')->resource('role', 'RoleController');
    Route::post('permission/save','PermissionController@save')->name('setting.permission.save');
    Route::get('permission/refresh','PermissionController@refresh')->name('setting.permission.refresh');
    Route::get('permission/destroyall','PermissionController@destroyAll')->name('setting.permission.destroy.all');
    Route::name('setting')->resource('permission', 'PermissionController');
});
